extends Control

var scroll_speed: float = 5

@onready var timer: Timer = get_node("Timer")
@onready var top_boundry = get_node("top_boundry")
@onready var bottom_boundry = get_node("bottom_boundry")

func _unhandled_input(event):
	if event.as_text() == "Escape":
		get_tree().change_scene_to_file("res://scenes/main_menu.tscn")

func _ready():
	timer.connect("timeout", activate_boundries)
	top_boundry.connect("area_entered", kill_player)
	bottom_boundry.connect("area_entered", kill_player)
	timer.start()

func activate_boundries():
	bottom_boundry.get_child(0).disabled = false
	timer.stop()

func kill_player(area):
	if area.name == "player":
		Global.player_dead = true
